package edu.jd.testdao;

import edu.jd.common.Utils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class TestStudentDao {

    public static void main(String[] args){
        SqlSession sess = Utils.openSession();
        try{
            TestDao dao = sess.getMapper(TestDao.class);
            List<StudentTest> stuList = dao.getStudentById("219001");
            sess.commit();
            System.out.println(stuList.get(0).getStu_name());
            System.out.println(stuList.get(0).getStu_class());
        }catch (Exception e){
            e.printStackTrace();
            sess.rollback();
            throw new RuntimeException("获取学生信息失败");
        }finally {
            sess.close();
        }
    }
}
